#ifndef __STHASHMAP_H_
#define __STHASHMAP_H_

#include <string>

#define ElementType int

class STHashMap
{
public:
    STHashMap(int HashSize);
    ~STHashMap();

    void Insert(const std::string& key, ElementType value);
    ElementType *Get(const std::string& key);

    ElementType & operator[](const std::string & key);
    void Remove(const std::string & key);
    void show();
    void showByKey();

private:
    struct Node
    {
        Node(const std::string& key, ElementType value)
        {
            this->key = key;
            this->data = value;
            next = nullptr;
        }
        
        std::string key;
        ElementType data;
        Node *next;
        
    };
    int STHash(const std::string & key);
    int HashSize;
    Node ** array;   //靠数组下标定位!!
};





#endif